// pages/product-detail/product-detail.js
Page({
  data: {
    isFollowing: false
  },

  onLoad: function(options) {
    console.log('页面加载完成');
  },

  goBack: function() {
    wx.navigateBack();
  },

  shareProduct: function() {
    wx.showToast({
      title: '分享功能已触发',
      icon: 'success'
    });
  },

  toggleFollow: function() {
    this.setData({
      isFollowing: !this.data.isFollowing
    });
    wx.showToast({
      title: this.data.isFollowing ? '已关注' : '已取消关注',
      icon: 'success'
    });
  },

  contactSeller: function() {
    wx.showToast({
      title: '联系卖家功能',
      icon: 'success'
    });
  },

  addToFavorites: function() {
    wx.showToast({
      title: '已添加到收藏',
      icon: 'success'
    });
  },

  showBuyDialog: function() {
    wx.showModal({
      title: '购买确认',
      content: '确定要购买此商品吗？',
      confirmText: '确定',
      cancelText: '取消',
      success: function(res) {
        if (res.confirm) {
          wx.showToast({
            title: '购买成功',
            icon: 'success'
          });
        }
      }
    });
  },

  sendComment: function() {
    wx.showToast({
      title: '评论已发送',
      icon: 'success'
    });
  }
});